<?php


class baseModel {

	private $crDB;
	private $lrQuery;

	public function connect() {
		global $con_username, $con_password, $con_sid, $con_host, $con_db;
		$this->crDB = oci_connect($con_username, $con_password, $con_sid);
		if($this->crDB) {
			return TRUE;
		} else {
			return FALSE;
		}
	}

	public function __construct() {
		if(!$this->connect()) {
			die("Nepodařilo se připojit k DB");
		}
	}

	public function SimpleQuery($isSQL) {
		$lrReturn = array();
		//
		$lrQuery = oci_parse($this->crDB, $isSQL);
		oci_execute($lrQuery);
		while($lsRow = @oci_fetch_array($lrQuery, OCI_ASSOC+OCI_RETURN_NULLS)) {
			$lrReturn[] = $lsRow;
		}
		return $lrReturn;
	}


	public function CreateQuery($isSQL) {
		$this->lrQuery = oci_parse($this->crDB, $isSQL);
	}

	public function __destruct() {
		oci_close($this->crDB);
	}

}


?>